//
//  GCDSemaphore.h
//  MyFunctionDemo
//
//  Created by Ting Han on 2017/8/28.
//  Copyright © 2017年 Ting Han. All rights reserved.
//

#import <Foundation/Foundation.h>

//信号量控制并发，控制最多几个并发，当超出这个数后，等待
@interface GCDSemaphore : NSObject

@property (strong, readonly, nonatomic) dispatch_semaphore_t dispatchSemaphore;

- (instancetype)initWithValue: (NSUInteger)value;
- (void)wait;
- (BOOL)waitWithTimeout: (NSTimeInterval)timeout;
- (BOOL)signal;

@end
